package com.e3mall.controller;

import com.e3mall.interfaces.ItemCatService;
import com.e3mall.utils.EasyUITreeNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @作者: Vgger
 * @E-Mail:1055106789@qq.com
 * @描述:
 * @修改时间: Created in 20:17 2018/4/24
 */
@Controller
public class ItemCatController {

    @Autowired
    private ItemCatService itemCatService;

    /**
     * 根据父节点id查询子节点数据,如果前台没有传输数据,默认值为0
     *
     * @param parentId
     * @return
     */
    @RequestMapping("/item/cat/list")
    @ResponseBody
    public List<EasyUITreeNode> itemCatList(@RequestParam(name = "id", defaultValue = "0") Long parentId) {
        return itemCatService.getItemCatTreeNodesByParentId(parentId);
    }

}
